<template>
  <div class="white">
    <!--    <h2>{{title}}</h2>-->
    <!--    <p> {{content}}</p>-->
    <el-card style="margin-bottom: 20px">
      <div style="margin-left: 20px">
issues

<div v-if="issues.length<=0">issues是空</div>
        <div>
          <div :key="issue.id" v-for="issue in issues">
            <h3>{{issue.title}}</h3>
             <div>{{issue.body}}</div>
              <!-- <div>issue id {{issue.id}}</div> -->
              <div>issue number {{issue.number}}</div>
                <div>issue.state {{issue.state}}</div>
                <el-button @click="toIssue(issue)">toIssue</el-button>

              
          </div>
        </div>
        <h2>{{ issue.title }}</h2>
        <!--      <p> {{issue.body}}</p>-->
        <!--      <vue-markdown>i am a ~~tast~~ **test**.</vue-markdown>-->
        <!--                <vue-markdown>{{issue.body}}</vue-markdown>-->
        <v-md-preview :text="issue.body"></v-md-preview>
        <!--                <p>  {{issue.body}}</p>-->
       
        <!-- <div> {{ api }}</div> -->
        <el-input v-model="api"></el-input>
         id:{{ issue.number }}   {{ issue.state }}
        <div class="little-time time">
          <el-row>
            创建于
            <DateShow class="little-time" :date="issue.created_at"></DateShow
          ></el-row>
          <el-row>
            更新于
            <DateShow class="updated_at" :date="issue.updated_at"></DateShow
          ></el-row>
          <el-row>
            关闭于
            <DateShow class="updated_at" :date="issue.closed_at"></DateShow
          ></el-row>
        </div>
        <!-- {{issue.created_at}} {{issue.updated_at}} {{issue.closed_at}} -->
        {{ issue.authorAssociation }} {{ issue?.user?.login }}
        {{ issue?.reactions?.totalCount }}
        <!--                <p> api {{api}}</p>-->
        <!--                <p> api {{api}}</p>-->

        <!--                <p> issue number {{issue.number}}</p>-->
        <!--                <p> issue state {{issue.state}}</p>-->
        <!--                &lt;!&ndash;                <p> issue createdAt {{issue.createdAt}}</p>&ndash;&gt;-->
        <!--                &lt;!&ndash;                <p> issue updatedAt {{issue.updatedAt}}</p>&ndash;&gt;-->
        <!--                &lt;!&ndash;                <p> issue closedAt {{issue.closedAt}}</p>&ndash;&gt;-->

        <!--                <p> issue createdAt {{issue.created_at}}</p>-->
        <!--                <p> issue updatedAt {{issue.updated_at}}</p>-->
        <!--                <p> issue closedAt {{issue.closed_at}}</p>-->

        <!--                <p> issue authorAssociation {{issue.authorAssociation}}</p>-->
        <!--                <p> issue 用户 {{issue.user.login}}</p>-->
        <!--                <p> issue reactions totalCount {{issue.reactions.totalCount}}</p>-->
        <!--    <p> {{issue.title}}</p>-->
      </div>
    </el-card>
    <!--        <el-table-->
    <!--                :data="tableData"-->
    <!--                style="width: 100%">-->
    <!--            &lt;!&ndash;      <el-table-column&ndash;&gt;-->
    <!--            &lt;!&ndash;        prop="date"&ndash;&gt;-->
    <!--            &lt;!&ndash;        label="日期"&ndash;&gt;-->
    <!--            &lt;!&ndash;        width="180">&ndash;&gt;-->
    <!--            &lt;!&ndash;      </el-table-column>&ndash;&gt;-->
    <!--            <el-table-column-->
    <!--                    prop="title"-->
    <!--                    label="标题"-->
    <!--                    width="500">-->
    <!--            </el-table-column>-->
    <!--        </el-table>-->

    <!--        <el-button type="primary" @click="postTest" class="submitBtn">postTest</el-button>-->

    <!--        <div>-->
    <!--            <div>评论标题</div>-->
    <!--            <div>评论内容</div>-->
    <!--            <div>鼓掌</div>-->
    <!--            <div>角色</div>-->
    <!--        </div>-->
    <el-button type="primary" @click="toGithub" class="submitBtn"
      >返回github首页</el-button
    >

    <p>回复</p>
    <p>评论数 {{ issue.comments }}</p>
    <!--    <div v-for="cm"></div>-->
    <div :key="comment.id" v-for="comment in comments">
      <!--      {{ tab.text }}-->
      <el-card>
        <!--        <div>评论标题</div>-->
        <!--        <div>评论内容</div>-->
        <!--        <div>鼓掌</div>-->
        <!--        <div>角色</div>-->
        <!--        <div>{{comment.title}}</div>-->
        <!--                <div>{{comment.body}}</div>-->
        <v-md-preview :text="comment.body"></v-md-preview>
        <!--        <div>用户: {{comment.user.login}}</div>-->
        用户: {{ comment.user.login }} 创建时间：{{
          comment.created_at
        }}
        更新时间：{{ comment.updated_at }}
        <!--                创建时间：{{comment.createdAt}}-->
        <!--                更新时间：{{comment.updatedAt}}-->

        <!--        <div>{{comment.created_at}}</div>-->
      </el-card>
    </div>

    <!--    <el-card></el-card>-->

    <!-- <el-input
    v-model="textarea"
    :rows="2"
    type="textarea"
    placeholder="Please input"
    />-->

    <el-input
      type="textarea"
      :rows="2"
      placeholder="请输入内容"
      v-model="textarea"
    ></el-input>
    <el-button type="primary" @click="submitCmt" class="submitCmt"
      >评论</el-button
    >
  </div>
</template>

<script>
import Global from "../util/global";
import DateShow from "@/components/date-show";
import method from "../util/method";
import { apiMark, codeError, RouteMark } from "../common/common";
import util from "../util/util";
import strUtil from "../util/strUtil";
import HttpUtil from "../util/HttpUtil";


// import router from "../router";
// import VueMarkdown from 'vue-markdown' // production
// import { ref } from 'vue'
// const textarea = ref('')
export default {
  name: "starp-issue",
  components: {
    // VueMarkdown
    DateShow,
  },
  // 代码来自
  // G:\project\JSProject\gissue.github.io\js\gissue.js
  methods: {

       toIssue(issue) {
        //  http://localhost:8081/Issues?repoName=dbeaver-driver-all&username=moshowgame&issueId=152
          //  this.parseApi();
        // let issueId= this.issueId
      // var api = "https://api.github.com/repos/" +     this.repoInfo.username + "/" +  
      // this.repoInfo.repopath+`/issues/${this.issueId}`;
      // /repos/{owner}/{repo}/issues/{issue_number}
      // let username=this.repoInfo.username
      let query=this.$route.query
      console.log("query")
            console.log(query)

      this.$router.push({
        path: "Issue",
        query: {
          repoName: query?.repoName,
          username: query?.username,
          issueId:issue?.number,
          //  issueUrl: api,
        },
      });
    },

    submitCmt() {
      // strUtil. isEmpty(this.textarea)
      // js 判断空
      //   if (this.textarea === "") {
      if (strUtil.isEmpty(this.textarea)) {
        this.$message.error("请输入");
        return;
      }
      if (issueId === null) {
        this.$message.error("没有 issue id 请查看");
        return;
      }
      let data = {
        issue_number: issueId,
        body: this.textarea,
      };
      method
        .postV3("/comment/CreateIssueComment", data)
        .then((response) => {
          console.log("response");
          console.log(response);

          if (response.data.code === codeError) {
            this.$message.error("账号或者密码有误");
          } else {
            this.$message.success(response.data.data);
          }
        })
        .catch(function (error) {
          console.log(error);
          this.$message.error(error);
        });
    },
    getComments() {
      // let api = localStorage.getItem(apiMark)
      // console.log("api")
      // console.log(api)
      let api = this.api;
      // api.
      // this.$router
      // this.$router query 获取
      // let age = this.$route.query.age; //问号后面参数会被封装进 this.$route.query;
      let issueId = this.$route.query.issueId;

      this.issueId = issueId;
      console.log("issueId");
      console.log(issueId);
      //
      let url = strUtil.urlAdd(api, `/issues/${issueId}/comments`);
      // let urlGetIss=  strUtil.urlAdd(api,`/issues/${issueId}`)

      let data = {
        commentsUrl: url,
      };
      // method.post("/comment/comments", data, this)
      method
        .postV3("/comment/comments", data)
        .then((response) => {
          console.log("response");
          console.log(response);

          if (response.data.code === codeError) {
            this.$message.error("账号或者密码有误");
          } else {
            // this.$message.success('登录成功');
            this.comments = response.data.data;

            this.comments.forEach((o) => {
              if (typeof o.user === "string") {
                console.log("parse user");
                o.user = JSON.parse(o.user);
              }
              if (typeof o.reactions === "string") {
                o.reactions = JSON.parse(o.reactions);
              }
            });

            console.log("this.comments");
            console.log(this.comments);
          }
        })
        .catch(function (error) {
          console.log(error);
        });
    },
    parseApi(crtUrl) {
      var urlSplit = crtUrl.split("/");
      //console.log(urlSplit);//list
      var username = urlSplit[3];
      var repopath = urlSplit[4];
      // js 获取列表最后一个元素
      let issueId = urlSplit.at(-1);

    // var repopath = urlSplit[4];

      var repoInfo = this.repoInfo;
      repoInfo.username = username;
      repoInfo.repopath = repopath;
      // repoInfo.username = username;
      // repoInfo.repopath = repopath;
      var api = "https://api.github.com/repos/" + username + "/" + repopath;

      console.log("Get GitHub api URL:" + api);
      return api;
    },
    toGithub() {
      // router.routes.na
      // RouteMark.Github
      // this.$router.push({path:  RouteMark.Github, query: {issueId: row.number}});
      this.$router.push({ path: RouteMark.Github });
    },
    putIssueData(response){
      if (response.data.code === codeError) {
          this.$message.error("账号或者密码有误");
        } else {
          // this.$message.success('登录成功');
          this.issue = response.data.data;
          // this.comments=response.data.data
          console.log("this.issue");
          console.log(this.issue);
          // comments
          // pull_request
          // this.issue.pull_request=JSON.parse(this.issue.pull_request)
          if (this.issue.body === null) {
            this.issue.body = "";
          }
          if (this.issue.comments > 0) {
            console.log("get comments");
            this.getComments();
          }
        }
    },
    postTest() {
      var user = {
        login: "login",
        nodeId: "nodeId",
      };
      var userStr = JSON.stringify(user);
      var issueForm = {
        activeLockReason: "string",
        assignee: "string",
        assignees: "string",
        authorAssociation: "string",
        body: "string",
        closedAt: "2022-02-09T09:55:46.631Z",
        comments: 0,
        commentsUrl: "string",
        createdAt: "2022-02-09T09:55:46.631Z",
        date: "2022-02-09T09:55:46.631Z",
        eventsUrl: "string",
        htmlUrl: "string",
        id: 0,
        labels: "string",
        labelsUrl: "string",
        locked: 0,
        milestone: "string",
        nodeId: "string",
        number: 0,
        performedViaGithubApp: 0,
        reactions: "string",
        repositoryUrl: "string",
        state: "string",
        timelineUrl: "string",
        title: "string",
        updatedAt: "2022-02-09T09:55:46.631Z",
        url: "string",
        // "user": user,
        user: userStr,
        userAvatar: "string",
        userName: "string",
        userUrl: "string",
      };

      // user 不是string
      console.log("issueForm");
      console.log(issueForm);
      method
        .post("/issue/save", issueForm, this)
        .then((response) => {
          console.log("response");
          console.log(response);

          if (response.data.port == "400") {
            this.$message.error("账号或者密码有误");
          } else {
            this.$message.success("登录成功");
            localStorage.setItem("ms_username", this.param.username);
            this.$cookies.set("token", response.data.token);
            this.$router.push("/");
          }
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    // 编辑操作
    onIssueClicked(index, row) {
      console.log("row.url");
      console.log(row.url);
      this.$router.push(row.url);
      // issue 界面 但是参数
      // 所有的issues 一个界面 列表
      // 链接是项目的 还是 github的
      // if(row.deleteFlag==1)
      // {
      //     this.$message.error("该单位不可用！");
      // }else{
      //     this.idx = index;
      //     this.form = row;
      //     this.editVisible = true;
      // }
    },

    getByWholeUrl(index, row) {
      let issueUrl = this.$route.query.issueUrl;
    console.log("issueUrl");
    console.log(issueUrl);

    axios.post(`${Global.axiosUrl}uploadImg`, fmData).then((res) => {
        console.log(res);
        // var src = `http://localhost:7001${res.data.data[0]}`;
        var src = `${Global.axiosUrl}${res.data.data[0]}`;
        // var src = `http://localhost:7002${res.data.data[0]}`;
        console.log("src");
        console.log(src);
        this.imgSrc = src;
        // var img = document.createElement("img");
        // img.src = src;
        // if (document.querySelector("img")) {
        //   document.querySelector("img").remove();
        // }
        // document.body.appendChild(img);
      });
    // /repos/{owner}/{repo}/issues/{issue_number}
// 
    },
    // onIssueClicked(evt){
    //     // 获取点击的 对象 a vue
    //
    //     console.log("evt")
    //     console.log(evt)
    //
    //     // 获取的是 html
    //     // vue 点击 获取数据
    //     console.log("evt.currentTarget");
    //     console.log(evt.currentTarget);
    //     console.log("evt.target");
    //     console.log(evt.target);
    // }
  },
  data() {
    let comment = {
      url: "https://api.github.com/repos/vmg/redcarpet/issues/comments/787130124",
      html_url:
        "https://github.com/vmg/redcarpet/issues/690#issuecomment-787130124",
      issue_url: "https://api.github.com/repos/vmg/redcarpet/issues/690",
      id: 787130124,
      node_id: "MDEyOklzc3VlQ29tbWVudDc4NzEzMDEyNA==",
      user: {
        login: "robin850",
        id: 354185,
        node_id: "MDQ6VXNlcjM1NDE4NQ==",
        avatar_url: "https://avatars.githubusercontent.com/u/354185?v=4",
        gravatar_id: "",
        url: "https://api.github.com/users/robin850",
        html_url: "https://github.com/robin850",
        followers_url: "https://api.github.com/users/robin850/followers",
        following_url:
          "https://api.github.com/users/robin850/following{/other_user}",
        gists_url: "https://api.github.com/users/robin850/gists{/gist_id}",
        starred_url:
          "https://api.github.com/users/robin850/starred{/owner}{/repo}",
        subscriptions_url:
          "https://api.github.com/users/robin850/subscriptions",
        organizations_url: "https://api.github.com/users/robin850/orgs",
        repos_url: "https://api.github.com/users/robin850/repos",
        events_url: "https://api.github.com/users/robin850/events{/privacy}",
        received_events_url:
          "https://api.github.com/users/robin850/received_events",
        type: "User",
        site_admin: false,
      },
      created_at: "2021-02-27T20:24:06Z",
      updated_at: "2021-02-27T20:24:06Z",
      author_association: "COLLABORATOR",
      body: "Hello,\r\n\r\nSorry for the late answer but actually the problem lies in the fact that `Redcarpet::Render::Base` doesn't implement any method by default ; `nil` is returned from every callback so you have to provide an implementation for each of them.\r\n\r\nThus, to fix your problem, you might have to do the following:\r\n\r\n~~~ruby\r\nclass ArticleCardHTMLRender < Redcarpet::Render::Base\r\n  def paragraph(text)\r\n    %(<p>#{text}</p>)\r\n  end\r\n\r\n  # ...\r\nend\r\n~~~\r\n\r\nOr extends from `Redcarpet::Render::HTML` as you mentioned (it's generally easier to go this way).",
      reactions: {
        url: "https://api.github.com/repos/vmg/redcarpet/issues/comments/787130124/reactions",
        total_count: 0,
        "+1": 0,
        "-1": 0,
        laugh: 0,
        hooray: 0,
        confused: 0,
        heart: 0,
        rocket: 0,
        eyes: 0,
      },
      performed_via_github_app: null,
    };
    let comments = [comment, comment];

    var issues = [
      {
        title: "111",
        url: "url",
      },
    ];
    var originData = [
      {
        date: "2016-05-02",
        name: "王小虎",
        address: "上海市普陀区金沙江路 1518 弄",
      },
      {
        date: "2016-05-04",
        name: "王小虎",
        address: "上海市普陀区金沙江路 1517 弄",
      },
      {
        date: "2016-05-01",
        name: "王小虎",
        address: "上海市普陀区金沙江路 1519 弄",
      },
      {
        date: "2016-05-03",
        name: "王小虎",
        address: "上海市普陀区金沙江路 1516 弄",
      },
    ];

    let issue = {
      id: 1012912885,
      userName: null,
      userUrl: null,
      userAvatar: null,
      date: null,
      url: "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122",
      body: "背景 : 当重新打开一个页面时,有很多设置需要重复操作,浪费时间\r\n修改 :\r\n    1 main.html: 增加 加载 cookie 的逻辑\r\n    2 common.js: 增加 cookie 设置 和 get 的 通用逻辑\r\n    3 main.js: 增加 将所有需要纪录的字段写入cookie逻辑,并加载到页面",
      repositoryUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator",
      labelsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/labels{/name}",
      commentsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/comments",
      eventsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/events",
      htmlUrl: "https://github.com/moshowgame/SpringBootCodeGenerator/pull/122",
      nodeId: "PR_kwDOCMCWTc4sin5A",
      number: 122,
      title: "避免重复配置",
      user: '{"avatarUrl":"https://avatars.githubusercontent.com/u/45098520?v=4","eventsUrl":"https://api.github.com/users/Thixiaoxiao/events{/privacy}","followersUrl":"https://api.github.com/users/Thixiaoxiao/followers","followingUrl":"https://api.github.com/users/Thixiaoxiao/following{/other_user}","gistsUrl":"https://api.github.com/users/Thixiaoxiao/gists{/gist_id}","gravatarId":"","htmlUrl":"https://github.com/Thixiaoxiao","id":45098520,"login":"Thixiaoxiao","nodeId":"MDQ6VXNlcjQ1MDk4NTIw","organizationsUrl":"https://api.github.com/users/Thixiaoxiao/orgs","receivedEventsUrl":"https://api.github.com/users/Thixiaoxiao/received_events","reposUrl":"https://api.github.com/users/Thixiaoxiao/repos","siteAdmin":0,"starredUrl":"https://api.github.com/users/Thixiaoxiao/starred{/owner}{/repo}","subscriptionsUrl":"https://api.github.com/users/Thixiaoxiao/subscriptions","type":"User","url":"https://api.github.com/users/Thixiaoxiao"}',
      state: "closed",
      labels: "[]",
      locked: 0,
      assignee: null,
      assignees: "[]",
      milestone: null,
      comments: 0,
      createdAt: "2021-10-01T05:25:32.000+00:00",
      updatedAt: "2021-10-30T16:48:12.000+00:00",
      closedAt: "2021-10-30T16:48:12.000+00:00",
      authorAssociation: "CONTRIBUTOR",
      activeLockReason: null,
      reactions:
        '{"confused":0,"eyes":0,"heart":0,"hooray":0,"laugh":0,"rocket":0,"totalCount":0,"url":"https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/reactions"}',
      timelineUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/timeline",
      performedViaGithubApp: null,
    };

    let issueTml = {
      id: 1012912885,
      userName: null,
      userUrl: null,
      userAvatar: null,
      date: null,
      url: "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122",
      body: "背景 : 当重新打开一个页面时,有很多设置需要重复操作,浪费时间\r\n修改 :\r\n    1 main.html: 增加 加载 cookie 的逻辑\r\n    2 common.js: 增加 cookie 设置 和 get 的 通用逻辑\r\n    3 main.js: 增加 将所有需要纪录的字段写入cookie逻辑,并加载到页面",
      repositoryUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator",
      labelsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/labels{/name}",
      commentsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/comments",
      eventsUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/events",
      htmlUrl: "https://github.com/moshowgame/SpringBootCodeGenerator/pull/122",
      nodeId: "PR_kwDOCMCWTc4sin5A",
      number: 122,
      title: "避免重复配置",
      user: {
        id: null,
        login: null,
        nodeId: null,
        avatarUrl: null,
        gravatarId: null,
        url: "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/reactions",
        htmlUrl: null,
        followersUrl: null,
        followingUrl: null,
        gistsUrl: null,
        reposUrl: null,
        subscriptionsUrl: null,
        organizationsUrl: null,
        starredUrl: null,
        eventsUrl: null,
        receivedEventsUrl: null,
        type: null,
        siteAdmin: null,
      },
      state: "closed",
      labels: [],
      locked: 0,
      assignee: null,
      assignees: [],
      milestone: null,
      comments: 0,
      createdAt: "2021-10-01T05:25:32.000+00:00",
      updatedAt: "2021-10-30T16:48:12.000+00:00",
      closedAt: "2021-10-30T16:48:12.000+00:00",
      authorAssociation: "CONTRIBUTOR",
      activeLockReason: null,
      reactions: {
        id: null,
        url: "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/reactions",
        totalCount: 0,
        addOne: null,
        minusOne: null,
        laugh: 0,
        heart: 0,
        hooray: 0,
        confused: 0,
        rocket: 0,
        eyes: 0,
      },
      timelineUrl:
        "https://api.github.com/repos/moshowgame/SpringBootCodeGenerator/issues/122/timeline",
      performedViaGithubApp: null,
    };

    return {
      issues:[],
      textarea: "",
      repoInfo: {},
      title: "title",
      content: "content",
      // tableData: issues,
      tableData: null,
      // comments: comments,
      comments: null,
      // issue: issue,
      // issue: issueTml,
        issue: {},
      // issue: {
      //     body:null
      // },
      // issue: null,
      api: null,
      issueId: null,
    };
  },
  created() {
    // https://blog.csdn.net/qq_25905159/article/details/107737266
    console.log("created issue");
    // this.makeComicLst()
    // let api= this.$cookies.get(apiMark);
    let api = localStorage.getItem(apiMark);
    // repoName
   let repoName= this.$route.query.repoName;
      let username= this.$route.query.username;

   
   console.log("repoName");
     console.log(repoName);
    console.log("api");
    console.log(api);
    this.api = api;
    // api.
    // this.$router
    // this.$router query 获取
    // let age = this.$route.query.age; //问号后面参数会被封装进 this.$route.query;
    let issueId = this.$route.query.issueId;
    let urlGetRepo = this.$route.query.urlGetRepo;
    console.log("urlGetRepo");
    console.log(urlGetRepo);
    console.log("issueId");
    console.log(issueId);
    let issueUrl = this.$route.query.issueUrl;
    console.log("issueUrl");
    console.log(issueUrl);
    let urlGetIss = strUtil.urlAdd(api, `/issues/${issueId}`);
    // if(!issueUrl){
    //   let urlGetIss = strUtil.urlAdd(api, `/issues/${issueId}`);
    // }
    if(issueUrl){
      urlGetIss=issueUrl
    }
    //
    let url = strUtil.urlAdd(api, `/issues/${issueId}/comments`);
   
    // getIssue

    // method.post("/issue/getIssue", {url: urlGetIss}, this)
    method
      .postV3("/issue/getIssue", { url: urlGetIss })
      .then((response) => {
        console.log("response");
        console.log(response);

        if (response.data.code === codeError) {
          this.$message.error("账号或者密码有误");
        } else {
          // this.$message.success('登录成功');
          this.issue = response.data.data;
          // this.comments=response.data.data
          console.log("this.issue");
          console.log(this.issue);
          // comments
          // pull_request
          // this.issue.pull_request=JSON.parse(this.issue.pull_request)
          if (this.issue.body === null) {
            this.issue.body = "";
          }
          if (this.issue.comments > 0) {
            console.log("get comments");
            this.getComments();
          }
        }
      })
      .catch(function (error) {
        console.log(error);
      });

        // post(url, data, vue) {
      // HttpUtil.post("http://localhost:8080/api/v1/gz-gitai/GitHub/IssueGet" ,)
      // http://localhost:8080
      // HttpUtil.postV3("http://localhost:8080/api/v1/gz-gitai/GitHub/IssueGet" , {
  //     HttpUtil.postV3("/api/v1/gz-gitai/GitHub/IssueGet" , {
  //         // "Number": 3455,
  //         // "Owner": "octocat",
  //         // "Repo": "Hello-World"

  //           "Number": parseInt(issueId) ,
  //         "Owner": username,
  //         "Repo": repoName
  //     },).then(resp=>{
  // console.log("resp")
  // console.log(resp)
  // this.putIssueData(resp)
  //     })
  //     .catch(error=> {
  //       console.log(error);
  //     });
  let IssueListByRepoOptions={}
 HttpUtil.postV3("/api/v1/gz-gitai/GitHub/IssuesList" , {
          // "Number": 3455,
          // "Owner": "octocat",
          // "Repo": "Hello-World"
          IssueListByRepoOptions,

            "Number": parseInt(issueId) ,
          "Owner": username,
          "Repo": repoName
      },).then(resp=>{
  console.log("resp")
  console.log(resp)
  this.putIssueData(resp)
  this.issues= resp?.data?.data
      })
      .catch(error=> {
        console.log(error);
      });
      
    // let data={
    //     commentsUrl:url
    // }
    // method.post("/comment/comments",data,this)   .then(response => {
    //     console.log("response")
    //     console.log(response)
    //
    //     if (response.data.code === codeError) {
    //         this.$message.error('账号或者密码有误');
    //     } else {
    //         this.$message.success('登录成功');
    //         this.comments=response.data.data
    //         console.log( "this.comments")
    //         console.log( this.comments)
    //     }
    // })
    //     .catch(function (error) {
    //         console.log(error);
    //     });
  },
};
</script>
<!--其他地方定义的 css 不引入的话 应该不行的吧-->
<style type="text/css">
.white {
  color: white;
}
/* .little-time {
  margin-right: 10px;
  margin-left: 5px;
} */
.little-time {
  font-size: 50%;
  display: flex;
  flex-direction: row;
  /* font-size: 50%; */
  margin-top: 10px;
}
</style>
